import instance from './index';

import axios from 'axios';
axios.defaults.withCredentials = true ;
import * as util from '../assets/util.js';

const instanceTest = axios.create({
    baseURL: 'http://10.199.251.242:8091',
    timeout: 10000
});
if(sessionStorage.getItem("token")){
    instanceTest.defaults.headers.common['Authorization'] = sessionStorage.getItem("token");
}
instanceTest.defaults.headers.post['Content-Type'] = 'application/json';
//错误处理
instanceTest.interceptors.response.use(function(response) {
    return response;
}, util.catchError);


const preUrlPath = '';
//查询药品
const request = {
    p: ['get,/test/user/2'],
    r: params => {
        return instance.get(`${preUrlPath}/cas-proxy/test/user/2`, {params})
    }
};


//查询药品
const requestAjax = {
    p: ['get,/test/test'],
    r: params => {
        return instanceTest.get(`${preUrlPath}/cas-proxy/test/test`, {params})
    }
};


export {
    request,requestAjax
}
